﻿using common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace common
{
    public class BytesMessages
    {
        private readonly static List<byte[]> bytes = new List<byte[]>()
        {
            System.Text.Encoding.UTF8.GetBytes(">["+Message.data_16+"]<"),
            System.Text.Encoding.UTF8.GetBytes(">["+Message.data_32+"]<"),
            System.Text.Encoding.UTF8.GetBytes(">["+Message.data_64+"]<"),
            System.Text.Encoding.UTF8.GetBytes(">["+Message.data_128+"]<"),
            System.Text.Encoding.UTF8.GetBytes(">["+Message.data_256+"]<"),
            System.Text.Encoding.UTF8.GetBytes(">["+Message.data_512+"]<"),
            System.Text.Encoding.UTF8.GetBytes(">["+Message.data_1024+"]<"),
            System.Text.Encoding.UTF8.GetBytes(">["+Message.data_2048+"]<"),
        };

        private readonly static List<string> strings = new List<string>()
        {
            ">["+Message.data_16+"]<",
            ">["+Message.data_32+"]<",
            ">["+Message.data_64+"]<",
            ">["+Message.data_128+"]<",
            ">["+Message.data_256+"]<",
            ">["+Message.data_512+"]<",
            ">["+Message.data_1024+"]<",
            ">["+Message.data_2048+"]<",
        };

        public int bytesindex = 0;
        public int messageIndex = 0;

        public byte[] GetMessage()
        {
            var message = bytes[bytesindex];
            if (bytesindex == bytes.Count - 1)
            {
                bytesindex = 0;
            }
            else
            {
                bytesindex++;
            }

            return message;
        }


        public string GetString()
        {
            var message = strings[messageIndex];
            if (messageIndex == bytes.Count - 1)
            {
                messageIndex = 0;
            }
            else
            {
                messageIndex++;
            }

            return message;
        }



    }
}
